// TorrentESRepository.java
package com.example.demo.repository.es;

import com.example.demo.model.es.TorrentES;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

public interface TorrentESRepository extends ElasticsearchRepository<TorrentES, Long> {
//    @Query("{\"bool\": {\"should\": [{\"match\": {\"fileName\": \"?0\"}}, {\"match\": {\"summary\": \"?0\"}}]}}")
    public Page<TorrentES> findByFileNameContainingOrSummaryContaining(String fileName, String summary, Pageable pageable);

    @Query("{\"bool\": {\"should\": [{\"match\": {\"fileName\": \"?0\"}}, {\"match\": {\"summary\": \"?0\"}}]}}")
    Page<TorrentES> advancedSearch(String query, Pageable pageable);
}